package AlienArena::Server::Bot;

use 5.006;
use lib '../..';
use AlienArena::Server::Bot::Config;
use strict;
use warnings;
our $VERSION = '0.01';

sub new {
    my $class = shift;
    my ($name, $skin, $skill) = @_;
    my $self = bless {}, $class;
    $self->name($name);
    $self->skin($skin);
    $self->skill($skill);
    return $self;
}

sub name {
    my $self = shift;
    return $self->{_name} = shift if @_;
    return $self->{_name};
}

sub skin {
    my $self = shift;
    return $self->{_skin} = shift if @_;
    return $self->{_skin};
}

# skill : 0 - 3

sub skill {
    my $self = shift;
    return $self->{_skill} = shift if @_;
    return $self->{_skill};
}

# team : red, blue or default
sub team {
    my $self = shift;
    return $self->{_team} = shift if @_;
    return $self->{_team};
}

sub taunt_strings {
    my $self = shift;
    return @{$self->{_taunt_strings}};
}

sub set_taunt_strings {
    my $self = shift;
    $self->{_taunt_strings} = [@_];
}

sub add_taunt {
    my $self = shift;
    my $taunt = shift;
    push @{$self->{_taunt_strings}}, $taunt;
    return;
}

# weapon_from_index : return the weapon name 
# for the argument (index)

sub weapon_from_index {
    my $class = shift;
    return $bot_weapon{shift()};
}

# weapon_index : return the line number of the configuration 
# file for the argument (weapon name)

sub weapon_index {
    my $class = shift;
    return $bot_weapon_index{shift()};
}

=head1 NAME

AlienArena::Server::Bot - Models an Alien Arena bot

=head1 SYNOPSIS

    use AlienArena::Server::Bot;

    my $bot = AlienArena::Server::Bot->new('Xlex')
    $bot->skill(1);
    $bot->team('blue');
    $bot->skin('martiancyborg');
    $bot->add_taunt('%s: Ach, du lieber %s!');
    $bot->add_taunt('%s: Zut alors, %s!');
    print join("\n", $bot->taunt_strings), "\n";

=head1 METHODS

=head2 new($name, $skin, $skill)

=head2 name

=head2 skin

=head2 skill

=head2 team

=head2 taunt_strings

=head2 add_taunt($taunt_text)

=head2 weapon_from_index($index)

=head2 weapon_index($weapon_name)

=head1 AUTHOR

Mark A. Jensen, C<< <maj -at- fortinbras -dot- us> >>

=head1 LICENSE AND COPYRIGHT

Copyright 2012 Mark A. Jensen.

This program is free software; you can redistribute it and/or modify it
under the terms of either: the GNU General Public License as published
by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

=cut

1; # End of AlienArena::Server::Bot
